package com.onpositive.data.kvstorage;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import com.onpositive.data.diskstorage.AbstractObjectCollection;
import com.onpositive.data.serializer.writers.DefaultWriterFactory;
import com.onpositive.data.serializer.writers.ObjectCollectionWriter;
import com.onpositive.datacollection.proxy.RemoteDataCollection;

public class DataCollectionStorer {

	public void downloadDataCollection(RemoteDataCollection cl,OutputStream stream) throws IOException{
		AbstractObjectCollection collection = cl.getCollection();
		ObjectCollectionWriter c=new ObjectCollectionWriter();
		c.setFactory(new DefaultWriterFactory());
		c.append(collection);
		DataOutputStream stream2 = new DataOutputStream(stream);
		c.serialize(stream2);
		stream2.close();
	}
}
